package com.sise.wangzhan.main;

import com.sise.wangzhan.client.PersonClient;
import feign.Feign;
import feign.gson.GsonDecoder;

/**
 * @Classname PersonMain
 * @Description TODO
 * @Date 2020/4/8 21:17
 * @Created by wangzhan
 */
public class PersonMain {
    public static void main(String[] args) {

        PersonClient personService = Feign.builder()
                //增加GsonDecoder解码器，会将返回的响应JSON字符串转换为接口方法返回的对象
                .decoder(new GsonDecoder())
                .target(PersonClient.class, "http://localhost:8080/");
        PersonClient.Person person = personService.findById(2);
        System.out.println(person.getPerson_id());
        System.out.println(person.getP_name());
        System.out.println(person.getAge());
        System.out.println(person.getMessage());


    }
}
